﻿using System;
using System.Globalization;
using System.Windows.Data;
using System.Windows.Input;
using System.Windows.Markup;

namespace BHS.TFSChangsetAnalyser.View
{
    [ValueConversion(typeof(bool), typeof(Cursor))]
    public class BoolToCursorConverter : MarkupExtension, IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return (bool)value ? Cursors.Wait : Cursors.Arrow;
        }
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return (bool)value ? Cursors.Arrow : Cursors.Wait;
        }

        public override object ProvideValue(IServiceProvider serviceProvider)
        {
            return instance;
        }

        private static BoolToCursorConverter instance = new BoolToCursorConverter();
    }
}
